import request from '../service/service';

/**
 * 获取角色信息
 */
export function getRoleList(data) {
  return request({
    protocol: 'bus/role/findPage',
    options: data,
    method: 'get',
  });
}

/**
 * 获取角色用户
 */
export function getRoleUserList(data) {
  return request({
    protocol: 'bus/role/get-roleUserList',
    options: data,
    method: 'get',
  });
}

/**
 * 角色批量添加/删除用户
 */
export function setRoleUserList(data) {
  return request({
    protocol: 'bus/role/set-roleUserList',
    options: data,
    method: 'post',
    hasQuery: true,
  });
}

/**
 * 新增角色
 */
export function addSystemRole(data) {
  return request({
    protocol: 'bus/role/create',
    options: data,
    method: 'post',
  });
}

/**
 * 删除角色
 */
export function delSystemRole(data) {
  return request({
    protocol: 'bus/role/deleteByIds',
    options: data,
    method: 'delete',
  });
}

/**
 * 修改角色
 */
export function updateSystemRole(data) {
  return request({
    protocol: 'bus/role/update',
    options: data,
    method: 'post',
  });
}

/**
 * 菜单树
 */
export function getMenuTree(data) {
  return request({
    protocol: 'bus/menu/tree',
    options: data,
    method: 'get',
  });
}

/**
 * 获取菜单分类
 */
export function getMenuClass(data) {
  return request({
    protocol: 'bus/menu/class/findPage',
    options: data,
    method: 'get',
  });
}

/**
 * 新增菜单分类
 */
export function addMenuClass(data) {
  return request({
    protocol: 'bus/menu/class/create',
    options: data,
    method: 'post',
  });
}

/**
 * 修改菜单分类
 */
export function updateMenuClass(data) {
  return request({
    protocol: 'bus/menu/class/update',
    options: data,
    method: 'post',
  });
}

/**
 * 删除菜单分类
 */
export function delMenuClass(data) {
  return request({
    protocol: 'bus/menu/class/deleteByIds',
    options: data,
    method: 'delete',
  });
}

/**
 * 新增菜单
 */
export function addMenu(data) {
  return request({
    protocol: 'bus/menu/create',
    options: data,
    method: 'post',
  });
}

/**
 * 删除菜单
 */
export function delMenu(data) {
  return request({
    protocol: 'bus/menu/deleteByIds',
    options: data,
    method: 'delete',
  });
}

/**
 * 修改菜单
 */
export function updateMenu(data) {
  return request({
    protocol: 'bus/menu/update',
    options: data,
    method: 'post',
  });
}

/**
 * 角色用户更新
 */
export function singleRoleUserList(data) {
  return request({
    protocol: 'bus/role/set-singleRoleUserList',
    options: data,
    method: 'post',
  });
}

/**
 * 获取用户菜单权限
 */
export function getUserPermissionTree(data) {
  return request({
    protocol: 'bus/role/get-userPermissionTree',
    options: data,
    method: 'get',
  });
}

/**
 * 获取角色的菜单权限树
 */
export function getRolePermissionTree(data) {
  return request({
    protocol: 'bus/role/tree/permissions',
    options: data,
    method: 'get',
  });
}

/**
 * 角色菜单权限设置,支持新增/修改
 */
export function setRolePermissions(data) {
  return request({
    protocol: 'bus/role/set/permissions',
    options: data,
    method: 'post',
  });
}

/**
 * 根据Id查询详情
 */
export function getRoleInfoById(data) {
  return request({
    protocol: 'bus/role/findById',
    options: data,
    method: 'get',
  });
}
